<template>
	<view>
		<!-- 菜单列表 -->
		<view class="operation flex u-border-top" v-if="type == 'Manager'">
			<view
				v-for="(item, index) in operationList"
				:key="index"
				@click="goRouter(item.menuLink)"
			>
				<u--image :src="item.menuIcon" width="70rpx" height="70rpx" />
				<view class="li-tit">{{ item.menuName }}</view>
			</view>
		</view>
		<!-- 门店列表 -->
		<view class="pad20">
			<view
				v-for="(item, index) in list"
				:key="index"
				@click="handleStore(item.sign)"
				class="flex row"
			>
				<u--image :src="item.avatar" width="160rpx" height="160rpx" />
				<view class="info">
					<view>{{ item.name }}</view>
					<view>门店电话:{{ item.phone }}</view>
					<view class="u-line-1" v-if="item.address">{{ item.address }}</view>
				</view>
				<u--image :src="imgUrl + 'li1.png'" width="45rpx" height="45rpx" />
			</view>
		</view>
	</view>
</template>

<script>
import { imgUrl } from '@/utils/baseUrl.js';
import { managerStoreSelect, managerHomeMenu, managerStore } from "@/api/admin.js"
export default {
	data() {
		return {
			imgUrl,
			type: '',
			operationList: [],
			list: []	
		}
	},
	onLoad(eve) {
		this.type = eve.type ?? ""
		managerStore().then(res => this.list= res)
		if(eve.type != 'Manager') return
		managerHomeMenu({roleCode: this.type}).then(res => this.operationList = res)
	},
	methods: {
		// 门店列表点击
		handleStore(storeSign) {
			let url = `/pagesSubPack/doctor/index?type=${this.type}`
			managerStore({ storeSign }).then(() => {
				this.goRouter(url)
			})
		},
		// 页面跳转
		goRouter(url) {
			uni.navigateTo({ url })
		}
	}
}
</script>

<style lang="scss" scoped>
.li-tit, .row {
	color: rgba(0, 0, 0, 0.6);
	font-size: 24rpx;
}
::v-deep .operation {
	padding: 20rpx;
	flex-wrap: wrap;
	background-color: #fff;
	.u-image {
		margin: auto;
	}
	> view {
		width: 25%;
		text-align: center;
	}
	.li-tit {
		margin: 20rpx 0;
	}
}
.row {
	background: #fff;
	border-radius: 20rpx;
	padding: 20rpx;
	margin-bottom: 20rpx;
	.info {
		flex: 1;
		margin: 0 20rpx;
		> view {
			&:first-child {
				color: rgba(0, 0, 0, 0.9);
				font-size: 32rpx;
			}
			&:nth-child(2) {
				padding: 14rpx 0;
			}
		}
	}
}
</style>
